/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.dengues.model.warehouse.impl;

import org.dengues.model.warehouse.BlockType;
import org.dengues.model.warehouse.WarehousePackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Block Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.dengues.model.warehouse.impl.BlockTypeImpl#getColor <em>Color</em>}</li>
 *   <li>{@link org.dengues.model.warehouse.impl.BlockTypeImpl#getName <em>Name</em>}</li>
 *   <li>{@link org.dengues.model.warehouse.impl.BlockTypeImpl#getPosX <em>Pos X</em>}</li>
 *   <li>{@link org.dengues.model.warehouse.impl.BlockTypeImpl#getPosY <em>Pos Y</em>}</li>
 *   <li>{@link org.dengues.model.warehouse.impl.BlockTypeImpl#getSizeH <em>Size H</em>}</li>
 *   <li>{@link org.dengues.model.warehouse.impl.BlockTypeImpl#getSizeW <em>Size W</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BlockTypeImpl extends EObjectImpl implements BlockType {
    /**
     * The default value of the '{@link #getColor() <em>Color</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getColor()
     * @generated
     * @ordered
     */
    protected static final int COLOR_EDEFAULT = 0;

    /**
     * The cached value of the '{@link #getColor() <em>Color</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getColor()
     * @generated
     * @ordered
     */
    protected int color = COLOR_EDEFAULT;

    /**
     * This is true if the Color attribute has been set.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     * @ordered
     */
    protected boolean colorESet;

    /**
     * The default value of the '{@link #getName() <em>Name</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getName()
     * @generated
     * @ordered
     */
    protected static final String NAME_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getName()
     * @generated
     * @ordered
     */
    protected String name = NAME_EDEFAULT;

    /**
     * The default value of the '{@link #getPosX() <em>Pos X</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getPosX()
     * @generated
     * @ordered
     */
    protected static final int POS_X_EDEFAULT = 0;

    /**
     * The cached value of the '{@link #getPosX() <em>Pos X</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getPosX()
     * @generated
     * @ordered
     */
    protected int posX = POS_X_EDEFAULT;

    /**
     * This is true if the Pos X attribute has been set.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     * @ordered
     */
    protected boolean posXESet;

    /**
     * The default value of the '{@link #getPosY() <em>Pos Y</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getPosY()
     * @generated
     * @ordered
     */
    protected static final int POS_Y_EDEFAULT = 0;

    /**
     * The cached value of the '{@link #getPosY() <em>Pos Y</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getPosY()
     * @generated
     * @ordered
     */
    protected int posY = POS_Y_EDEFAULT;

    /**
     * This is true if the Pos Y attribute has been set.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     * @ordered
     */
    protected boolean posYESet;

    /**
     * The default value of the '{@link #getSizeH() <em>Size H</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getSizeH()
     * @generated
     * @ordered
     */
    protected static final int SIZE_H_EDEFAULT = 0;

    /**
     * The cached value of the '{@link #getSizeH() <em>Size H</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getSizeH()
     * @generated
     * @ordered
     */
    protected int sizeH = SIZE_H_EDEFAULT;

    /**
     * This is true if the Size H attribute has been set.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     * @ordered
     */
    protected boolean sizeHESet;

    /**
     * The default value of the '{@link #getSizeW() <em>Size W</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getSizeW()
     * @generated
     * @ordered
     */
    protected static final int SIZE_W_EDEFAULT = 0;

    /**
     * The cached value of the '{@link #getSizeW() <em>Size W</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getSizeW()
     * @generated
     * @ordered
     */
    protected int sizeW = SIZE_W_EDEFAULT;

    /**
     * This is true if the Size W attribute has been set.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     * @ordered
     */
    protected boolean sizeWESet;

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected BlockTypeImpl() {
        super();
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    protected EClass eStaticClass() {
        return WarehousePackage.Literals.BLOCK_TYPE;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public int getColor() {
        return color;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setColor(int newColor) {
        int oldColor = color;
        color = newColor;
        boolean oldColorESet = colorESet;
        colorESet = true;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, WarehousePackage.BLOCK_TYPE__COLOR, oldColor, color, !oldColorESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void unsetColor() {
        int oldColor = color;
        boolean oldColorESet = colorESet;
        color = COLOR_EDEFAULT;
        colorESet = false;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.UNSET, WarehousePackage.BLOCK_TYPE__COLOR, oldColor, COLOR_EDEFAULT, oldColorESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public boolean isSetColor() {
        return colorESet;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getName() {
        return name;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setName(String newName) {
        String oldName = name;
        name = newName;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, WarehousePackage.BLOCK_TYPE__NAME, oldName, name));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public int getPosX() {
        return posX;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setPosX(int newPosX) {
        int oldPosX = posX;
        posX = newPosX;
        boolean oldPosXESet = posXESet;
        posXESet = true;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, WarehousePackage.BLOCK_TYPE__POS_X, oldPosX, posX, !oldPosXESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void unsetPosX() {
        int oldPosX = posX;
        boolean oldPosXESet = posXESet;
        posX = POS_X_EDEFAULT;
        posXESet = false;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.UNSET, WarehousePackage.BLOCK_TYPE__POS_X, oldPosX, POS_X_EDEFAULT, oldPosXESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public boolean isSetPosX() {
        return posXESet;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public int getPosY() {
        return posY;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setPosY(int newPosY) {
        int oldPosY = posY;
        posY = newPosY;
        boolean oldPosYESet = posYESet;
        posYESet = true;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, WarehousePackage.BLOCK_TYPE__POS_Y, oldPosY, posY, !oldPosYESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void unsetPosY() {
        int oldPosY = posY;
        boolean oldPosYESet = posYESet;
        posY = POS_Y_EDEFAULT;
        posYESet = false;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.UNSET, WarehousePackage.BLOCK_TYPE__POS_Y, oldPosY, POS_Y_EDEFAULT, oldPosYESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public boolean isSetPosY() {
        return posYESet;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public int getSizeH() {
        return sizeH;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setSizeH(int newSizeH) {
        int oldSizeH = sizeH;
        sizeH = newSizeH;
        boolean oldSizeHESet = sizeHESet;
        sizeHESet = true;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, WarehousePackage.BLOCK_TYPE__SIZE_H, oldSizeH, sizeH, !oldSizeHESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void unsetSizeH() {
        int oldSizeH = sizeH;
        boolean oldSizeHESet = sizeHESet;
        sizeH = SIZE_H_EDEFAULT;
        sizeHESet = false;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.UNSET, WarehousePackage.BLOCK_TYPE__SIZE_H, oldSizeH, SIZE_H_EDEFAULT, oldSizeHESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public boolean isSetSizeH() {
        return sizeHESet;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public int getSizeW() {
        return sizeW;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setSizeW(int newSizeW) {
        int oldSizeW = sizeW;
        sizeW = newSizeW;
        boolean oldSizeWESet = sizeWESet;
        sizeWESet = true;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, WarehousePackage.BLOCK_TYPE__SIZE_W, oldSizeW, sizeW, !oldSizeWESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void unsetSizeW() {
        int oldSizeW = sizeW;
        boolean oldSizeWESet = sizeWESet;
        sizeW = SIZE_W_EDEFAULT;
        sizeWESet = false;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.UNSET, WarehousePackage.BLOCK_TYPE__SIZE_W, oldSizeW, SIZE_W_EDEFAULT, oldSizeWESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public boolean isSetSizeW() {
        return sizeWESet;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public Object eGet(int featureID, boolean resolve, boolean coreType) {
        switch (featureID) {
            case WarehousePackage.BLOCK_TYPE__COLOR:
                return new Integer(getColor());
            case WarehousePackage.BLOCK_TYPE__NAME:
                return getName();
            case WarehousePackage.BLOCK_TYPE__POS_X:
                return new Integer(getPosX());
            case WarehousePackage.BLOCK_TYPE__POS_Y:
                return new Integer(getPosY());
            case WarehousePackage.BLOCK_TYPE__SIZE_H:
                return new Integer(getSizeH());
            case WarehousePackage.BLOCK_TYPE__SIZE_W:
                return new Integer(getSizeW());
        }
        return super.eGet(featureID, resolve, coreType);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public void eSet(int featureID, Object newValue) {
        switch (featureID) {
            case WarehousePackage.BLOCK_TYPE__COLOR:
                setColor(((Integer)newValue).intValue());
                return;
            case WarehousePackage.BLOCK_TYPE__NAME:
                setName((String)newValue);
                return;
            case WarehousePackage.BLOCK_TYPE__POS_X:
                setPosX(((Integer)newValue).intValue());
                return;
            case WarehousePackage.BLOCK_TYPE__POS_Y:
                setPosY(((Integer)newValue).intValue());
                return;
            case WarehousePackage.BLOCK_TYPE__SIZE_H:
                setSizeH(((Integer)newValue).intValue());
                return;
            case WarehousePackage.BLOCK_TYPE__SIZE_W:
                setSizeW(((Integer)newValue).intValue());
                return;
        }
        super.eSet(featureID, newValue);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public void eUnset(int featureID) {
        switch (featureID) {
            case WarehousePackage.BLOCK_TYPE__COLOR:
                unsetColor();
                return;
            case WarehousePackage.BLOCK_TYPE__NAME:
                setName(NAME_EDEFAULT);
                return;
            case WarehousePackage.BLOCK_TYPE__POS_X:
                unsetPosX();
                return;
            case WarehousePackage.BLOCK_TYPE__POS_Y:
                unsetPosY();
                return;
            case WarehousePackage.BLOCK_TYPE__SIZE_H:
                unsetSizeH();
                return;
            case WarehousePackage.BLOCK_TYPE__SIZE_W:
                unsetSizeW();
                return;
        }
        super.eUnset(featureID);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public boolean eIsSet(int featureID) {
        switch (featureID) {
            case WarehousePackage.BLOCK_TYPE__COLOR:
                return isSetColor();
            case WarehousePackage.BLOCK_TYPE__NAME:
                return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
            case WarehousePackage.BLOCK_TYPE__POS_X:
                return isSetPosX();
            case WarehousePackage.BLOCK_TYPE__POS_Y:
                return isSetPosY();
            case WarehousePackage.BLOCK_TYPE__SIZE_H:
                return isSetSizeH();
            case WarehousePackage.BLOCK_TYPE__SIZE_W:
                return isSetSizeW();
        }
        return super.eIsSet(featureID);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public String toString() {
        if (eIsProxy()) return super.toString();

        StringBuffer result = new StringBuffer(super.toString());
        result.append(" (color: ");
        if (colorESet) result.append(color); else result.append("<unset>");
        result.append(", name: ");
        result.append(name);
        result.append(", posX: ");
        if (posXESet) result.append(posX); else result.append("<unset>");
        result.append(", posY: ");
        if (posYESet) result.append(posY); else result.append("<unset>");
        result.append(", sizeH: ");
        if (sizeHESet) result.append(sizeH); else result.append("<unset>");
        result.append(", sizeW: ");
        if (sizeWESet) result.append(sizeW); else result.append("<unset>");
        result.append(')');
        return result.toString();
    }

} //BlockTypeImpl
